<%@ page contentType="text/html; charset=utf-8" language="java" errorPage="" %>
<%@taglib prefix="s" uri="/struts-tags" %>
<p class="page">
		<s:if test="!queryDO || !queryDO.totalItem || queryDO.totalItem==0">			
		</s:if> 
		<s:else>
			<s:set name="next" value="queryDO.toPage + 1" />
            <s:set name="prev" value="queryDO.toPage - 1" />			
			<s:if test="queryDO.toPage == 1">
				<a><span>&lt;</span></a>
        	</s:if>
        	<s:else>
        		<a href="#" onclick="changePage('<s:property value="#prev" />');return false;"><span>&lt;</span></a>
            </s:else>
			<s:bean name="org.apache.struts2.util.Counter" id="counter">
			<s:param name="first" value="1" />
			<s:param name="last" value="queryDO.totalPage" />
			 <s:if test="queryDO.toPage >4">
			<s:set name="#counts" value="9"></s:set>
			</s:if>
			<s:else>
			<s:set name="#counts" value="9-5+queryDO.toPage"></s:set>
			</s:else>
			<s:subset start="queryDO.toPage-5" count="#counts" >
			<s:iterator status="count">
			   <s:if test="queryDO.toPage<5">
			   <s:set name="cur" value="#count.index+1"></s:set>
				</s:if>
				<s:else>
				<s:set name="cur" value="queryDO.toPage-5+#count.index+1"></s:set>
				</s:else>
				<s:if test="queryDO.toPage == #cur">
				 <a href="#" class="page_on"><s:property /></a>
				</s:if>
				<s:else>
			      <a href="#" onclick="changePage('<s:property />');return false;"><s:property /></a>
				</s:else>					
				</s:iterator>
				</s:subset>
			</s:bean>          	
			<s:if test="queryDO.totalPage > queryDO.toPage + 4">
        		<span>...</span>
        	</s:if>	        
			<s:if test="queryDO.toPage == queryDO.totalPage">
        		<a><span>&gt;</span></a>
        	</s:if>
        	<s:else>
        		<a href="#" onclick="changePage('<s:property value="#next" />');return false;"><span>&gt;</span></a>
       	    </s:else>			
	        <span>共<s:property value="queryDO.totalPage" />页 向第<input type="text" name="jumpto" id="jumpto" class="input-text" size="2" maxlength="5" value="<s:property value="queryDO.toPage" />" tabIndex=200 />页 <a href="#" class="tz" onclick='javascript:changePage($("#jumpto").val());'>跳转</a></span>       	    
       	</s:else>
</p>
<script language="javascript">
   function changePage(page) {
		if(page <= 0){
			page = 1;
		}
		var totalpage = Number('<s:property value="queryDO.totalPage" />');
		if(page > totalpage){
			page = totalpage;
		}
		var totalItem = Number('<s:property value="queryDO.totalItem" />');		
        doSearch(page, totalItem);
    }
</script>